package ru.paswd.marketprice.data.repositories

import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import ru.paswd.marketprice.listener.OnProcessListener

class RepositoryCallback<T>(private val listener: OnProcessListener<T>) : Callback<T> {
    override fun onResponse(call: Call<T>, response: Response<T>) {
        listener.onResult(response.isSuccessful, response.body())
    }
    override fun onFailure(call: Call<T>, t: Throwable) {
        listener.onResult(false, null)
    }
}